-def save(fd, dominfo, live, dst):
+def save(fd, dominfo, network, live, dst):
write_exact(fd, SIGNATURE, "could not write guest state file: signature")
config = sxp.to_string(dominfo.sxpr())
dominfo.setName('migrating-' + domain_name)
try:
- dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP1, domain_name)
+ dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP1, domain_name)
write_exact(fd, pack("!i", len(config)),
"could not write guest state file: config len")
log.debug("Suspending %d ...", dominfo.getDomid())
dominfo.shutdown('suspend')
dominfo.waitForShutdown()
- dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP2,
+ dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2,
domain_name)
log.info("Domain %d suspended.", dominfo.getDomid())
- dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP3,
+ dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP3,
domain_name)
tochild.write("done\n")
tochild.flush()
raise XendError("Cannot migrate privileged domain %i" % domid)
""" The following call may raise a XendError exception """
- dominfo.testMigrateDevices(live, dst)
+ dominfo.testMigrateDevices(True, dst)
if port == 0:
port = xroot.get_xend_relocation_port()
sock.send("receive\n")
sock.recv(80)
- XendCheckpoint.save(sock.fileno(), dominfo, live, dst)
+ XendCheckpoint.save(sock.fileno(), dominfo, True, live, dst)
def domain_save(self, domid, dst):
fd = os.open(dst, os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
try:
# For now we don't support 'live checkpoint'
- return XendCheckpoint.save(fd, dominfo, False, dst)
+ return XendCheckpoint.save(fd, dominfo, False, False, dst)
finally:
os.close(fd)
except OSError, ex:
## public:
- def testMigrateDevices(self, live, dst):
+ def testMigrateDevices(self, network, dst):
""" Notify all device about intention of migration
@raise: XendError for a device that cannot be migrated
"""
for (n, c) in self.info['device']:
- rc = self.migrateDevice(n, c, live, dst, DEV_MIGRATE_TEST)
+ rc = self.migrateDevice(n, c, network, dst, DEV_MIGRATE_TEST)
if rc != 0:
raise XendError("Device of type '%s' refuses migration." % n)
- def migrateDevices(self, live, dst, step, domName=''):
+ def migrateDevices(self, network, dst, step, domName=''):
"""Notify the devices about migration
"""
ctr = 0
try:
for (n, c) in self.info['device']:
- self.migrateDevice(n, c, live, dst, step, domName)
+ self.migrateDevice(n, c, network, dst, step, domName)
ctr = ctr + 1
except:
for (n, c) in self.info['device']:
if ctr == 0:
step = step - 1
ctr = ctr - 1
- self.recoverMigrateDevice(n, c, live, dst, step, domName)
+ self.recoverMigrateDevice(n, c, network, dst, step, domName)
raise
- def migrateDevice(self, deviceClass, deviceConfig, live, dst, step, domName=''):
- return self.getDeviceController(deviceClass).migrate(deviceConfig, live, dst, step, domName)
+ def migrateDevice(self, deviceClass, deviceConfig, network, dst,
+ step, domName=''):
+ return self.getDeviceController(deviceClass).migrate(deviceConfig,
+ network, dst, step, domName)
- def recoverMigrateDevice(self, deviceClass, deviceConfig, live, dst, step, domName=''):
- return self.getDeviceController(deviceClass).recover_migrate(deviceConfig, live, dst, step, domName)
+ def recoverMigrateDevice(self, deviceClass, deviceConfig, network,
+ dst, step, domName=''):
+ return self.getDeviceController(deviceClass).recover_migrate(
+ deviceConfig, network, dst, step, domName)
def waitForDevices(self):
"""Wait for this domain's configured devices to connect.
raise NotImplementedError()
- def migrate(self, deviceConfig, live, dst, step, domName):
- """ Migration of a device. The 'live' parameter indicates
- whether the device is live-migrated (live=1). 'dst' then gives
+ def migrate(self, deviceConfig, network, dst, step, domName):
+ """ Migration of a device. The 'network' parameter indicates
+ whether the device is network-migrated (True). 'dst' then gives
the hostname of the machine to migrate to.
This function is called for 4 steps:
If step == 0: Check whether the device is ready to be migrated
return 0
- def recover_migrate(self, deviceConfig, list, dst, step, domName):
+ def recover_migrate(self, deviceConfig, network, dst, step, domName):
""" Recover from device migration. The given step was the
last one that was successfully executed.
"""
return result
- def migrate(self, deviceConfig, live, dst, step, domName):
+ def migrate(self, deviceConfig, network, dst, step, domName):
"""@see DevContoller.migrate"""
- if live:
+ if network:
tool = xroot.get_external_migration_tool()
if tool != '':
- log.info("Request to live-migrate device to %s. step=%d.",
+ log.info("Request to network-migrate device to %s. step=%d.",
dst, step)
if step == DEV_MIGRATE_TEST:
return -1
return 0
- def recover_migrate(self, deviceConfig, live, dst, step, domName):
+ def recover_migrate(self, deviceConfig, network, dst, step, domName):
"""@see DevContoller.recover_migrate"""
- if live:
+ if network:
tool = xroot.get_external_migration_tool()
if tool != '':
- log.info("Request to recover live-migrated device. last good step=%d.",
+ log.info("Request to recover network-migrated device. last good step=%d.",
step)
fd = os.popen("%s -type vtpm -step %d -host %s -domname %s -recover" %
(tool, step, dst, domName),